package main

import (
	"fmt"
)

func defArr() {
	var a [3]int
	var b = [...]int{1, 2, 3}
	var c = [...]int{2: 3, 1: 2}
	var d = [...]int{1, 2, 4: 5, 6}

	fmt.Println("print a")
	for i, v := range a {
		fmt.Println(i, v)
	}
	fmt.Println("print b")
	for i, v := range b {
		fmt.Println(i, v)
	}
	fmt.Println("print c")
	for i, v := range c {
		fmt.Println(i, v)
	}
	fmt.Println("print d")
	for i, v := range d {
		fmt.Println(i, v)
	}
	fmt.Println("print d")
	for i := range d {
		fmt.Println(i, d[i])
	}
}

func arrPointer() {
	var a = [...]int{1, 2, 3}
	var b = &a
	fmt.Println(a[0], a[1])
	fmt.Println(b[0], b[1])

	for i, v := range b {
		fmt.Println(i, v)
	}

	for i := 0; i < len(b); i++ {
		fmt.Println(i, b[i])
	}

	var times [5][0]int
	for range times {
		fmt.Println("hello")
	}

	fmt.Printf("%T\n", b)
	fmt.Printf("%#v\n", b)
}

func empty() {
	c1 := make(chan [0]int)
	go func() {
		fmt.Println("c1")
		c1 <- [0]int{}
	}()
	<-c1
}

func main() {
	// defArr()
	arrPointer()
	// empty()
}
